﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Sustainalytics.DataLayer.Shared;
using Sustainalytics.Entities;

namespace Sustainalytics.Controversies.BusinessLogic
{
    public interface IPlainBl<T> where T : IEntity
    {
        bool Drop();

        bool Create(T obj);

        bool CreateBatch(IEnumerable<T> obj);

        bool CreateOrUpdate(T obj);

        bool CreateOrUpdateBatch(IEnumerable<T> obj);

        bool Delete(Guid id);

        void Delete(IEnumerable<Guid> ids);

        bool DeleteWhere(Expression<Func<T, bool>> wherePredicate);

        bool DeleteAll();

        T Read(Guid id);

        IList<T> ReadAll();

        IList<T> ReadAll(string[] includedFields, int? skip = null, int? take = null, Ordering<T> ordering = null, bool useCollation = false);

        IList<T> ReadAllWhere(Expression<Func<T, bool>> wherePredicate, int? skip = null, int? take = null);

        IList<T> ReadAllWhereFieldEqualsValue<TK>(Expression<Func<T, TK>> selectPropertyExpression, TK value, int? skip = null, int? take = null, string[] includedFields = null);

        IList<T> ReadAllWhereFieldEqualsValue<TK>(string fieldName, TK value, int? skip = null, int? take = null, string[] includedFields = null);

        IDictionary<Guid, T> ReadbyIds(IEnumerable<Guid> ids, string[] includedFields = null);

        long ReadCount();

        IList<T> ReadWhere(Expression<Func<T, bool>> wherePredicate, int? skip = null, int? take = null,
            params Expression<Func<T, object>>[] includeFields);

        bool Update(Guid id, T obj);

        long ReadCount(Expression<Func<T, bool>> wherePredicate);


        string ToString();
    }
}
